package co.com.timer;

import java.math.BigDecimal;

public class CreditCardTransaction {

	private final String cardNumber;

	private final BigDecimal amount;
	
	/**
	* Creates a new instance with the specified card number and amount * @param cardNumber
	* @param amount
	* @throws IllegalArgumentException If either argument is null
	*/
	public CreditCardTransaction(final String cardNumber, final BigDecimal amount) throws IllegalArgumentException
	{
		// Precondition checks
		if (cardNumber == null || cardNumber.length() == 0) {
			throw new IllegalArgumentException("card number must be specified"); }
		if (amount == null) {
			throw new IllegalArgumentException("amount must be specified");
		}
		this.amount = amount;
		this.cardNumber = cardNumber;
	}

	public String toString() {
		return "CreditCardTransaction [amount=" + amount + ", cardNumber=" + cardNumber + "]";
	}

	public String getCardNumber() {
		return cardNumber;
	}

	public BigDecimal getAmount() {
		return amount;
	}
}
